<script src="__TMPL__/public/max.js"></script>
<!-- <script src="__PUBLIC__/js/common.js"></script> -->
<script>
layui.config({
    base: '__TMPL__/public/layuiadmin/' //静态资源所在路径
}).extend({
    index: 'lib/index' //主入口模块
}).use(['index', 'layedit', 'form', 'table', 'element'], function() {
    var $ = layui.$,
        form = layui.form,
        element = layui.element,
        table = layui.table,
        layedit = layui.layedit;

    layedit.set({
        //暴露layupload参数设置接口 --详细查看layupload参数说明
        uploadImage: {
            url: '/Attachment/LayUploadFile',
            accept: 'image',
            acceptMime: 'image/*',
            exts: 'jpg|png|gif|bmp|jpeg',
            size: '10240'
        },
        uploadVideo: {
            url: '/Attachment/LayUploadFile',
            accept: 'video',
            acceptMime: 'video/*',
            exts: 'mp4|flv|avi|rm|rmvb',
            size: '20480'
        }
        //右键删除图片/视频时的回调参数，post到后台删除服务器文件等操作，
        //传递参数：
        //图片： imgpath --图片路径
        //视频： filepath --视频路径 imgpath --封面路径
        ,
        calldel: {
            url: '/Attachment/DeleteFile'
        }
        //开发者模式 --默认为false
        ,
        devmode: true
            //插入代码设置
            ,
        codeConfig: {
            hide: true, //是否显示编码语言选择框
            default: 'javascript' //hide为true时的默认语言格式
        },
        tool: [
            'code', 'strong', 'italic', 'underline', 'del', 'addhr', '|', 'fontFomatt', 'colorpicker', 'face', '|', 'left', 'center', 'right', '|', 'link', 'unlink', 'anchors', '|', 'fullScreen'
        ],
        height: '160'
    });

    var indexParse = layedit.build('editParse');

    var indexAnswer = layedit.build('editAnswer');

    var index = layedit.build('edit');

    form.verify({
        edit: function(value) {
            return layedit.sync(index);
        }
    });

    form.on('submit(submit)', function(data) {
        $('input#edit-input').val(layedit.getContent(index));
        console.log(layedit.getContent(index));
        $('input#editParse-input').val(layedit.getContent(indexParse));
        $('input#editAnswer-input').val(layedit.getContent(indexAnswer));
    });


    element.render();
});
</script>